<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<?php view_include('admin/inc_head') ?>
	<title><?php echo page_title('用户详情') ?></title>
</head>
<body>
<!--主体内容-->
<div class="fancybox_wrap">
	<!-- Nav tabs -->
	<ul class="nav nav-tabs" role="tablist">
		<li role="presentation" class="active"><a href="javascript:;">用户详情</a></li>
	</ul>
	<div class="margin-top"></div>
	<!-- Tab panes -->
	<div class="tab-content">
		<div role="tabpanel" class="tab-pane active" id="home">
			<div class="form-horizontal pub-form">
				<form action="<?php echo site_url('admin/user/add/'.$user['id'])?>" method="post">
					<div class="form-group">
						<div class="col-sm-6 input_padding">
							<label class="col-xs-3 control-label"><b class="pink"></b>微信头像</label>
							<div class="col-xs-9 input_padding">
								<?php
								$head_img = $user['headimgurl'] ? $user['headimgurl'] : base_url('assets/images/no.jpg');
								$nickname = $user['nickname'] ? $user['nickname'] : '未关注用户';
								?>
								<img style="width:40px;" src="<?php echo $head_img ?>" />
							</div>
						</div>
						<div class="col-sm-6 input_padding">
							<label class="col-xs-3 control-label"><b class="pink"></b>微信昵称</label>
							<div class="col-xs-9 input_padding">
								<img src="">
								<?php echo $nickname ?>
							</div>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-6 input_padding">
							<label class="col-xs-3 control-label"><b class="pink"></b>性别</label>
							<div class="col-xs-9 input_padding">
								<?php
                                echo sex($user['sex']);
								?>
							</div>
						</div>
						<div class="col-sm-6 input_padding">
							<label class="col-xs-3 control-label"><b class="pink"></b>城市</label>
							<div class="col-xs-9 input_padding">
								<?php echo $user['country'].'-'.$user['province'].'-'.$user['city'] ?>
							</div>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-6 input_padding">
							<label class="col-xs-3 control-label"><b class="pink"></b>手机号</label>
							<div class="col-xs-9 input_padding">
								<?php echo $user['mobile'] ?>
							</div>
						</div>
						<div class="col-sm-6 input_padding">
							<label class="col-xs-3 control-label"><b class="pink"></b>状态</label>
							<div class="col-xs-9 input_padding">
								<?php echo resource('user_status', $user['state']); ?>
							</div>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-6 input_padding">
							<label class="col-xs-3 control-label"><b class="pink"></b>创建时间</label>
							<div class="col-xs-9 input_padding">
								<?php echo date_str($user['ctime'], 'long') ?>
							</div>
						</div>
						<div class="col-sm-6 input_padding">
							<label class="col-xs-3 control-label"><b class="pink"></b>关注时间</label>
							<div class="col-xs-9 input_padding">
								<?php echo date_str($user['subscribe_time'], 'long') ?>
							</div>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-6 input_padding">
							<label class="col-xs-3 control-label"><b class="pink"></b>操作</label>
							<div class="col-xs-9 input_padding">
								<a href="javascript:;"
								   onclick="javascript:user_change_status(<?php echo $user['id'] ?>, <?php echo $user['state'] == 0 ? -1 : 0 ?>);"
								   class="btn btn-sm <?php echo $user['state'] == 0 ? 'btn-dlanding' : 'btn-edit' ?>">
									<?php echo $user['state'] == 0 ? '禁止登陆' : '启用' ?></a>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<script>
	function user_change_status( id, change_status ) {
		$.get(
			'<?php echo site_url('admin/user/change_status/') ?>/'+id+'/'+change_status,
			function( data ){
				if( data.status ){
					location.reload();
				}
			}, "json"
		);
	}
</script>
</body>
</html>